#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2018/12/6 11:32
# @Author  : lizhen
# @Site    : 
# @File    : reutil.py
# @Software: PyCharm
import re


class ReMatch:
    def test_100(self):
        for i in range(101):
            result = re.match('^[1-9]?\d?$|^100$', str(i))
            assert result.group() == str(i)

    def test_ip(self):
        s = 'this is a number 234-234-22-432'
        print(re.search(r'.+(\d+-\d+-\d+-\d+)', s).group(1))
        print(re.search(r'.+?(\d+-\d+-\d+-\d+)', s).group(1))


def main():
    rm = ReMatch()
    # rm.test_100()
    rm.test_ip()


if __name__ == '__main__':
    main()
